import {Dimensions, PixelRatio} from 'react-native';

export const stringTofixed = str => {
  const priceFloat = parseFloat(str);
  const result = priceFloat.toFixed(2);
  return result;
};

export const screenWidth = Dimensions.get('window').width;
export const screenHeight = Dimensions.get('window').height;

const {width} = Dimensions.get('window');
const baseWidth = 375; // 设计稿的宽度
const scale = width / baseWidth;
export const normalize = size => {
  const newSize = size * scale;
  return Math.round(PixelRatio.roundToNearestPixel(newSize));
};
